func moveCollect() {
    moveForward()
    collectGem()
}

func moveToggle() {
    moveForward()
    toggleSwitch()
}

func turnAround() {
    turnLeft()
    turnLeft()
}

turnLeft()
moveForward()
greenPortal.isActive = false
moveForward()

moveCollect()
turnAround()
moveForward()
turnRight()

moveCollect()
turnAround()
greenPortal.isActive = true
moveForward()

greenPortal.isActive = false

for i in 1...4 {
    
    moveToggle()
    turnAround()
    
    if i == 4 {
        greenPortal.isActive = true
    }
    
    moveForward()
    turnLeft()
}

moveForward()
moveCollect()
orangePortal.isActive = false
moveForward()

for i in 1...3 {
    turnLeft()
    moveCollect()
    turnAround()
    
    if i == 3 {
        orangePortal.isActive = true
    }
    
    moveForward()
}

turnLeft()
moveToggle()
turnAround()

orangePortal.isActive = false

moveForward()
turnRight()
moveToggle()
